#include<iostream>
using namespace std;
typedef long long LL;
LL n;
int main()
{
	cin >> n;
	LL ans = 0;
	LL x = 0;
	LL sum = 0;
	//for (int i = 1; i <= 1e4; i++) {
	//	if ((1 + i) * i > 2 * n) {
	//		x = i;
	//		break;
	//	}
	//}
	//cout << n - (x) * (x - 1) / 2 << endl;
	/*for (LL i = 2;; i++) {
		if (ans + i > n) {
			break;
		}
		sum += 1;
		ans += sum;
		x = i;
	}*/
	LL l = 1, r = 1;
	for (LL i = 2;; i++) {
		r = l + i;
		if (r >= n) {
			break;
		}
		l = r;
	}
	cout << n - l << endl;
	return 0;
}